Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refers to #3.
This PR comes after #27. It adds
crates/rulean-core/src/expr.rsandcrates/rulean-core/src/memo.rs.The expression operations are a transcription of
instantiate.cpp,abstract.cpp, the loose bound variable part ofexpr.cppandexpr_eq_fn.cppof the official kernel v4.35.0:instantiate,instantiate_from,instantiate1andinstantiate_rev. A substituted value is lifted under the binders, as in the official code.lift_loose_bvars,lower_loose_bvars,has_loose_bvarandabstract_fvars.instantiate_lparams. A changed level is made again with the simplifications oflevel::instantiate.app_fn,app_args,app_num_argsandmk_rev_app.apply_beta,head_betaandcheap_beta_reduce.expr_equal, the==of the official kernel. It ignores binder names and binder info, and it uses the pair cache ofexpr_eq_fn.The official functions use
replacewith a cache for shared nodes. Here each operation has its own recursion and aMemokeyed by the node and the binder offset.Memois a small map on the verifiedTablewith epochs, so a clear is O(1). A free variable is an atom, so the operations do not go into its type.Store change. The hash of a
lam,piorletnode no longer mixes the binder name or the binder info. This is the method of Lean. Alpha-equivalent terms now have equal hashes, soexpr_equalcan reject on a hash mismatch. The interning table still compares the full node, so handles stay exact.Tests:
crates/rulean-core/tests/expr.rshas 9 tests. The store tests pass without a change.